package com.unionpay.mpds.util;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;

public class CellStyle {

    static HSSFCellStyle cellStyle=null;
    static HSSFFont fontStyle=null;
	public CellStyle(HSSFWorkbook wb)
	{
		cellStyle=wb.createCellStyle();
		fontStyle=wb.createFont();
	}
	
	public CellStyle(){}
	/**
	 * 表头格式
	 * @return
	 */
	public static HSSFCellStyle geHeadCellStyle(HSSFWorkbook wb){  
		if(null==fontStyle)
			fontStyle=wb.createFont();
		if(null==cellStyle)
			cellStyle=wb.createCellStyle();
		fontStyle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
		fontStyle.setFontHeightInPoints((short)11);
		cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
		cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
		cellStyle.setFont(fontStyle);

		return cellStyle;
	}
	/**
	 * 表内容格式
	 * @return
	 */
	public static HSSFCellStyle getContentStyle(){
		 fontStyle.setFontHeightInPoints((short)11);
	     cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
	     cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
        cellStyle.setFont(fontStyle);
	    cellStyle.setWrapText(true);
		  return cellStyle;
	}
	/**
	 * 表的说明信息格式
	 * @return
	 */

	 public static HSSFCellStyle getHeadInfo(){
		 cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//		 cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//		 cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT);
		 fontStyle.setFontHeightInPoints((short)12);
		 fontStyle.setColor(HSSFColor.DARK_RED.index);
		 cellStyle.setFont(fontStyle);
		 return cellStyle;
	 }
	    

}
